package org.liveboardgames.agricola.control.delegates
{
	import com.adobe.cairngorm.business.ServiceLocator;

	import mx.rpc.IResponder;

	import org.liveboardgames.agricola.model.AgricolaModelLocator;
	import org.liveboardgames.agricola.vo.common.IResourceContainer;
	import org.liveboardgames.agricola.vo.farm.Farm;
	import org.liveboardgames.agricola.vo.farm.FarmTile;
	import org.liveboardgames.common.dictionary.collections.HashCollection;

	public class AddFarmElementDelegate
	{
		private var _responder:IResponder;

		private var _service:Object;

		public function AddFarmElementDelegate(responder:IResponder)
		{
			this._service = ServiceLocator.getInstance().getRemoteObject("farmService");
			this._responder = responder;
		}

		public function addFarmElement(tile:FarmTile, farmElement:String):void
		{
			var call:Object = _service.addFarmElement(AgricolaModelLocator.getInstance().game.id, tile.uniqueId, farmElement);
			call.resultHandler = _responder.result;
			call.faultHandler = _responder.fault;
		}
	}
}